import java.util.Deque;

public class CleanTask extends Thread {
    private Deque<Event> mQues;

    public CleanTask(Deque<Event> mQues) {
        super();
        this.mQues = mQues;
        setDaemon(true);

    }

    @Override
    public void run() {
        if (null != mQues) {
            while (true) {
                try {
                    if (mQues.isEmpty()) {
                        continue;
                    }
                    Event last = mQues.getLast();
                    long time = last.getTime();
                    if (System.currentTimeMillis() - time > 10000) {
                        last.print();
                        mQues.removeLast();
                    }
                } catch (Exception e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }

        }

    }

}
